<script type="text/javascript">
    function onCheckClick(ckContent)
    {
        if(ckContent.checked)
            ckContent.value="true";
        else
            ckContent.value="false"
        if(ckContent.name=="ckFocusContent")
        {
            //var url = "<?php echo url_for("other/focus"); ?>" + "?random=" +  Math.random() + "&catalogId=1000&contentTypeId=1000";
            //var focusId = window.showModalDialog(url,null,"dialogWidth:800px;dialogHeight:400px;help:0;status:0;scroll:1;center:1;resizeable:off;");
            //if(focusId != null)
              //$("#txtHideFocusId").val(focusId);
            if(ckContent.checked)
                $("#trFocus").css("display","block");
            else
                $("#trFocus").css("display","none");
        }
    }
	var relatedVideo = "";
    var currentTab = "video";
    var orderStr = "";
    function onRelatedCheckClick(ckRelated, relatedType)
    {
        if(ckRelated != null)
        {
            var tempValue = ckRelated.name ;//+ "," + ckRelated.value
            switch(relatedType)
            {
                case "video":
                   if(ckRelated.checked)
                        relatedVideo += tempValue + ";";
                   else
                        relatedVideo = relatedVideo.replace(tempValue + ";","");
                   break;
            }
        }
    }

    function onSubmit(submitType)
    {
        $("#txtHideRelatedVideo").val(relatedVideo.substr(0,relatedVideo.length-1));
        switch(submitType)
        {
            case "add":
               $("#txtSubmitType").val("add");
        }
        //return true;
    }

    function onSearch()
    {
        if($.trim($("#txtSearch").val()) == "")
        {
            alert("请输入 Tag 值。");
            return ;
        }
        $("#btnSearch").attr("disabled",true);
        var onSearchingMessage = "正在搜索......";
        $("#divListVideo").html(onSearchingMessage);
        var random = Math.random();
        var searchArray = $.trim($("#txtSearch").val()).split(/,|，/);
        var whereStr = "";
        for(var i = 0 ; i < searchArray.length; i++)
        {
            if(i == 0)
                whereStr = "tag like '%" + searchArray[i] + "%'";
            else
                whereStr += " or " + "tag like '%" + searchArray[i] + "%'";
        }
        whereStr = encodeURI( "(" + whereStr + ")");
        $.ajax({url:"<?php echo url_for("other/jQuery");?>",data:"random=" + random +"&submitFlag=relatedSearch&whereStr=" + whereStr +"&searchType=" + currentTab ,success: onSuccessSearch,error:onErrorSearch})
    }

    function onSuccessSearch(oMessage)
    {
        switch(currentTab)
        {
            case "video":
               //alert(oMessage);
               $("#divListVideo").html(oMessage);
               break;
        }

        $("#btnSearch").attr("disabled",false);
    }

    function onErrorSearch(x, e)
    {
        alert(x.responseText);
        $("#btnSearch").attr("disabled",false);
    }
</script>
<script type="text/javascript" src="/js/flowplayer-3.2.4.min.js"></script>
<form action="" method="post" enctype="multipart/form-data">
<table width="795" border="0" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  <tr>
    <td height="22" colspan="5">视频发布：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="btnBack" type="button" value="取 消" onclick="history.go(-1);" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="btnPublish" type="submit" value="发 布" onclick="onSubmit('publish')" style="display:none;" /></td>
  </tr>
  <tr>
    <td height="22" colspan="5" valign="top">栏目：
        <label><?php
        @include_component("other","catalog",array("selectedId"=>$sf_request->getParameter("catalogId")));
        ?>
      </label></td>
    </tr>
  <tr>
    <td height="22" colspan="5" valign="top">视频类别：
      <label>
      <?php
        @include_component("other","contentCatalog",array("selectedId"=>$sf_request->getParameter("subCatalogId"),"contentTypeId"=>1001));
        ?>
      </label></td>
    </tr>
  <tr>
    <td height="22" colspan="5" valign="top">文档属性：推荐
			  <input type="checkbox" name="ckRecommendContent" value="false" onclick="onCheckClick(this)" />&nbsp;&nbsp;&nbsp;
			  焦点
			  <input type="checkbox" name="ckFocusContent" value="false" onclick="onCheckClick(this)" />&nbsp;&nbsp;&nbsp;
              置顶
              <input type="checkbox" name="ckTop" value="false" onclick="onCheckClick(this)" />
&nbsp;&nbsp;</td>
    </tr>
	<tr>
        <td height="19" colspan="5">
            <div style="display:none;" id="trFocus">
            <?php echo include_component("other","focus"); ?>    </div>        </td>
    </tr>
  <tr>
    <td height="22" colspan="5" valign="top"><label>缩略图：
        <input type="text" id="Txt1" name="Txt1" /><input type="button" value="浏览"  onclick="getFileUrlFromCKFinder('Txt1','Img1')"  />
    </label></td>
    </tr>
  <tr>
    <td colspan="5" height="160px"><input type="hidden" value="1" id="Hid1" name="Hid1">      <img id="Img1" width="184" height="138" alt="184X138"/></td>
    </tr>
  <tr>
    <td height="22" colspan="5" valign="top">标&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;题：
      <label>
      <input name="title" type="text" size="28" maxlength="28" />
    (28字以内)      </label></td>
    </tr>
  <tr>
    <td height="22" colspan="5" valign="top">作&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;者：
      <input name="artist" type="text" size="20" maxlength="100" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;来源：
      <input name="source" type="text" size="20" maxlength="100" />
    </td>
  </tr>
  <tr>
    <td colspan="5" valign="top">
        <table width="90%" border="0" cellspacing="0" cellpadding="0">
			  <tr>
				<td width="62px" height="25px">TAG标签：</td>
                <td><input class="focusText" type="text" name="tag" onkeyup='$("#txtSearch").val(this.value);' size="20" value="XXX,XXX,XXX"/></td>
				<td rowspan="2">多个关键字和TAG标签，请以“，”分隔</td>
			  </tr>
			  <tr>
				<td height="25px" align="right">关键字：</td>
                <td><input class="focusText" name="keyword" type="text" value="XXX,XXX,XXX" size="20" /></td>
			  </tr>
			</table>
       </td>
   </tr>
   <tr>
    <td height="22" colspan="2" valign="top">视频上传：
      <input name="button3" type="button" value="视频库"  onclick="getFileUrlFromCKFinder('Txt3','Img3','video')" />
      <input id="Txt3" name="Txt3" type="text" /></td>
    <td width="92">&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td height="1"></td>
    <td width="518"></td>
    <td></td>
    <td></td>
    <td></td>
    </tr>
  <tr>
    <td height="22" colspan="5" valign="top" align="left">视频预览：</td>
    </tr>
  <tr>
    <td colspan="5" valign="top"><input type="hidden" value="1" id="Hid3" name="Hid3">
<!--        <img id="Img3" alt="600X300" width="600" height="300" />-->
        <div style="width:600px;height:300px;" id="player"></div>
    </td>
    </tr>
  <tr>
    <td height="22" colspan="5" valign="top">是否审核：
      <input type="radio" id="auditing1" name="auditing" value="1" disabled="true" />
是
<input type="radio" id="auditing0" name="auditing" value="0"  checked="checked" disabled="true" />
否&nbsp;&nbsp;时长：
        <input name="duration" type="text" maxlength="8" value="00:00:00" size="10" />&nbsp;&nbsp;&nbsp;&nbsp;发布时间：
      <input name="nowtime" type="text" value="<?php echo date("Y-m-d H:i:s"); ?>" id="nowtime" />&nbsp;&nbsp;<input type="button" value="设为当前时间" onclick="$('#nowtime').val(getCurrentDateTimeStr());"/></td>
    </tr>
  <tr>
    <td height="22" colspan="5" valign="top">点&nbsp;&nbsp;击&nbsp;&nbsp;率：
      <input name="hit" type="text" readonly="readonly" size="10" value="0" />
&nbsp;&nbsp;&nbsp;点击调整：
<input name="hitMark" type="text" size="10" value="0" /></td>
    </tr>
  <tr>
    <td height="22" colspan="5" valign="top">内容简介：</td>
    </tr>
  <tr>
    <td height="55" colspan="5" valign="top"><label>
      <textarea name="brief" cols="70" rows="4">(如果不另行输入，默认为文章前100字)</textarea>
    </label></td>
    </tr>
  <tr style="display:none;">
    <td height="231" colspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td width="795" height="231" valign="top"><p>播放列表：</p>          <p>特别推荐：</p></td>
          </tr>
    </table></td>
    </tr>
  <tr>
     <td colspan="5">
        <table border="0">
            <tr>
                <td align="right" valign="bottom" style="height:40px;">相关搜索：</td>
              <td valign="bottom"><input type="text" name="txtSearch" id="txtSearch">&nbsp;&nbsp;<input type="button" id="btnSearch" value="搜 索" onclick="onSearch()">&nbsp;(请输入 Tag 值，多个Tag值，请以逗号“，”分隔)</td>
            </tr>
        </table>
    </td>
  </tr>
  <tr>
    <td>
	   <table height="100%" width="100%" cellSpacing="0" cellPadding="0" style="width:930px;">
			<tr height="25px" style="display:none;">
				<td style="padding-left:10px">
					<table style="height: 22px;" cellSpacing="0" cellPadding="0" border="0">
						<tr valign="bottom">
							<td vAlign="bottom" style="FONT-SIZE: 9pt"><span class="tab tabOn" tabIndex="0" id="tabNews" tabID="tab0" onclick="onTabClick('tabNews')">相关新闻</span><span class="tab" tabIndex="1" tabID="tab2" id="tabVideo" onclick="onTabClick('tabVideo')">相关视频</span><span class="tab" tabIndex="2" tabID="tab2" id="tabPhoto" onclick="onTabClick('tabPhoto')">相关图片</span></td>
						</tr>
					</table>
				</td>
			</tr>
            <tr>
				<td style="padding-left:5px">
                    <div class="tab" id="divVideo">
                        <div class="lists" id="divListVideo">在“相关搜索”文本框中，输入相应的 Tag 值，点击“搜索”按钮，即可找到相关信息。</div>
                    </div>
                </td>
            </tr>
</table>
	</td>
  </tr>
  <tr>
    <td colspan="5" align="middle" style="height:50px;"><input name="btnAdd" type="submit" id="btnAdd" value="添 加" onclick="onSubmit('add')" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="btnBack" type="button" value="取 消" onclick="history.go(-1);" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="btnPublish" type="submit" id="btnPublish" value="发 布" onclick="onSubmit('publish')" style="display:none;" /></td>
  </tr>
</table>
<input name="txtHideRelatedVideo" type="hidden" id="txtHideRelatedVideo" />
<input name="txtSubmitType" value="add" type="hidden" id="txtSubmitType" />
<script>
    flowplayer('player', '/js/flowplayer-3.2.5.swf');
</script>
</form>